package com.synygy.bdviewer.ui;

import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.Page;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * Created by IntelliJ IDEA.
 * User: Popovici
 * Date: Oct 1, 2008
 * Time: 2:36:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class STIObjectApplication extends WebApplication {
    private static Log logger = LogFactory.getLog(STIObjectApplication.class);

    public STIObjectApplication() {
    }

    @Override
    protected void init() {
        logger.info("Starting up STIObject application...");
        logger.info("Configuring Wicket-Spring interaction...");
        addComponentInstantiationListener(new SpringComponentInjector(this, context()));
    }

    @Override
    public Class<? extends Page> getHomePage() {
        return Home.class;
    }

    public static STIObjectApplication get() {
        return (STIObjectApplication) WebApplication.get();
    }

    public ApplicationContext context() {
        return WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext());
    }
}

